﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;

namespace MS.INV
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

                Lib.Controls.DBConn.Connect c = new Lib.Controls.DBConn.Connect();
                if (!c.DoConnect())
                    return;

                Systems.Options.LoadOption();
                Lib.Bases.DB.RunBackup bck = new Lib.Bases.DB.RunBackup();

                if (File.Exists(Application.StartupPath + @"\Updates\Fix_Pack.zip"))
                {
                    Lib.Utils.Uti.RunFile(Application.StartupPath + @"\Updater.exe");

                    Application.Exit();
                    return;
                }

                Lib.Bases.Admin.Login lg = new Lib.Bases.Admin.Login();
                lg.StartPosition = FormStartPosition.CenterScreen;
                if (lg.ShowDialog() == DialogResult.Cancel)
                {
                    Application.Exit();
                    return;
                }
            
            Application.Run(new SMain());
        }
    }
}
